home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
gui
/
muibuilderv11.lha
/
muibuilder
/
mb
/
e
/
click
/
Click.e
< prev
next >
Wrap
Text File
|
1994-03-07
|
4KB
|
117 lines
/******************************************************************************
Here is an example of an "environnement file". All you have to do, si to
fill it with :
- use MUIBuilder+GenCodeE to generate the create_app() function
- add the code for your application !!!
******************************************************************************/
OPT OSVERSION=37
/* Module definitions */
MODULE 'muimaster', 'libraries/mui'
MODULE 'utility/tagitem', 'utility/hooks'
MODULE 'intuition/classes', 'intuition/classusr'
/* Error handling */
ENUM NO_LIBRARY, MUI_APPLICATION_FAILURE
RAISE NO_LIBRARY IF OpenLibrary()=NIL,
MUI_APPLICATION_FAILURE IF Mui_NewObjectA()=NIL
/* Constant definitions */
CONST MUI_TRUE = 1
/* Global variables */
/*MUIB*/ DEF app, wi_try, tx_label_0, bt_1stbutton, bt_2ndbutton, bt_3rdbutton
/*MUIB*/ DEF stR_TX_label_0 : PTR TO CHAR
/* Main procedure */
PROC main() HANDLE
DEF signal, result_DoMethod, running = TRUE
muimasterbase := OpenLibrary('muimaster.library', 0)
create_app()
/* Notify : close gadget => end of application */
doMethod( wi_try, [ MUIM_Notify, MUIA_Window_CloseRequest, MUI_TRUE, app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit ] )
/* Open the window */
set( wi_try, MUIA_Window_Open , MUI_TRUE )
WHILE running
result_DoMethod := doMethod( app, [ MUIM_Application_Input, {signal} ] )
SELECT result_DoMethod
CASE MUIV_Application_ReturnID_Quit
running := FALSE
ENDSELECT
IF (running AND signal) THEN Wait( signal )
ENDWHILE
Mui_DisposeObject( app )
CloseLibrary( muimasterbase )
EXCEPT
SELECT exception
CASE NO_LIBRARY
CASE MUI_APPLICATION_FAILURE
ENDSELECT
ENDPROC
/* Procedure generated by GenCodeE which creates your application */
PROC create_app()
stR_TX_label_0 := '\e8\ecClick on buttons'
app := ApplicationObject,
MUIA_Application_Author, 'Eric Totel',
MUIA_Application_Base, 'CLICK',
MUIA_Application_Title, 'Click',
MUIA_Application_Version, '$VER : Click 1.0',
MUIA_Application_Copyright, 'Eric Totel 1994',
MUIA_Application_Description, 'just a demo !!!',
SubWindow, wi_try := WindowObject,
MUIA_Window_Title, 'Click !!!',
MUIA_Window_ID, MAKE_ID( "0", "W", "I", "N" ),
WindowContents, GroupObject,
Child, tx_label_0 := TextObject,
MUIA_Background, 131,
MUIA_Text_Contents, stR_TX_label_0,
MUIA_Text_SetMax, 0,
MUIA_Text_SetMin, 1,
MUIA_Frame, 9,
End,
Child, GroupObject,
MUIA_Group_Horiz, MUI_TRUE,
MUIA_Group_SameWidth, MUI_TRUE,
Child, bt_1stbutton := KeyButton( 'Button 1', "1" ),
Child, bt_2ndbutton := KeyButton( 'Button 2', "2" ),
Child, bt_3rdbutton := KeyButton( 'Button 3', "3" ),
End,
End,
End,
End
ENDPROC
/* DoMethod() function */
PROC doMethod( obj:PTR TO object, msg:PTR TO msg )
DEF h:PTR TO hook, o:PTR TO object, dispatcher
IF obj
o := obj-SIZEOF object /* instance data is to negative offset */
h := o.class
dispatcher := h.entry /* get dispatcher from hook in iclass */
MOVEA.L h,A0
MOVEA.L msg,A1
MOVEA.L obj,A2 /* probably should use CallHookPkt, but the */
MOVEA.L dispatcher,A3 /* original code (DoMethodA()) doesn't. */
JSR (A3) /* call classDispatcher() */
MOVE.L D0,o
RETURN o
ENDIF
ENDPROC NIL